package com.example.backend.dao;

import com.example.backend.pojo.Logs;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LogsRepository extends JpaRepository<Logs,Integer> {
    @Query(value = "SELECT * FROM logs WHERE user_id=?1 AND status = true",nativeQuery = true)
    Logs findLogsByUserID(int userID);
    @Query(value = "SELECT * FROM logs WHERE user_id=?1 AND room_id=?2 AND status = true",nativeQuery = true)
    Logs findLogsByUserIDAndRoomID(int userID,int roomID);
    @Query(value = "SELECT * FROM logs WHERE user_id=?1 AND status = false",nativeQuery = true)
    List<Logs> findAllLogsByUserID(int userID);
}
